package com.example.tatil.config;

import com.example.tatil.interceptor.DemoIntercrptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration//配置类声明
public class Webconfig implements WebMvcConfigurer {


    @Autowired
    private DemoIntercrptor demoIntercrptor;

    //添加拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(demoIntercrptor).addPathPatterns("/**").excludePathPatterns("/login");
    }
}
